﻿@ECHO OFF

SET PATH=%PATH%;C:\Windows\Microsoft.NET\Framework\v4.0.30319;

REM Remove the existing code base
rmdir /s /q \\server_name\share_name\centraldba_db\code > nul
del /f /q \\server_name\share_name\centraldba_db\last_build.txt > nul

REM Cleanup old compiles
CD ..\..
rmdir /s /q centraldba_db\obj > nul
rmdir /s /q centraldba_db\sql > nul
rmdir /s /q DBAdmin\obj > nul
rmdir /s /q DBAdmin\bin > nul

REM Build the project
msbuild centraldba_db.sln /nologo /verbosity:minimal /target:Build /property:Configuration=Release

REM Copy the new code base
mkdir \\server_name\share_name\centraldba_db\code
xcopy * \\server_name\share_name\centraldba_db\code /s

echo \\server_name\share_name\centraldba_db\code was last populated on %DATE% %TIME% > \\server_name\share_name\centraldba_db\last_build.txt

CD centraldba_db\Setup
